import {getUserInfo} from "@/utils/format";
import {request} from "@@/plugin-request/request";
import ServiceEnvs from "@/services/ServiceEnvs";

const baseUrl = ServiceEnvs.baseUrl

// 01 - 进度圆环图
export const ProgressCircle = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/index/province/progress-percent', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data,
  })
}

// 02 - 学科评估
export const SubjectEvaluation = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/index/province/evaluation', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data,
  })
}

// 2号菜单-学校对应的学科列表
export const SubjectsOfSchool = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/index/province/subjects_of_school', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data,
  })
}

export const UserCacheApi = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/fill_switch/check-is-out', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 首页 - 突击队 11 个 Logo
export const TjdLogo = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-tjd', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 首页 - 突击队学科第四轮评估情况
export const Tjd4Evaluation = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-tjd-4-evaluation', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 首页 - 国家级学术领军人才（含青年人才）情况
export const TjdLeaders = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-tjd-leaders', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 首页 - 详情 - 主持国家重点重大项目情况
export const TjdBigProjectDetail = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-tjd-hold-big-project-detail', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 首页 -详情 - 国家级学术领军人才（含青年人才）情况
export const TjdLeadersDetail = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-tjd-leaders-detail', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 查看所有表内容
export const ProvinceAllDetail = (univ_name: string, discipline_name: string, fill_id: string) => {
  const userInfo = getUserInfo()

  let url = '/api/index/gov-query/query-table-detail-info'

  if (fill_id === '2_2_4' || fill_id === '2_3_1'
    || fill_id === '3_2_3' || fill_id === '3_2_4' || fill_id === '3_2_5') {
    url = '/api/index/gov-query/query-single-table-info'
  }

  const id_arr = fill_id.split(',')
  for (let i = 0; i < id_arr.length; i++) {
    id_arr[i] = "'" + id_arr[i] + "'"
  }
  fill_id = id_arr.join(',')

  return request(baseUrl+url, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: {
      "univ_name": univ_name, // 学校
      "discipline_name": discipline_name, // 学科
      "fill_id": fill_id, // 表号
    }
  })
}

// 首页 -详情 - 学科国家级教学成果奖情况
export const TjdBigAwardDetail = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-tjd-big-award-detail', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 首页 - 详情 - 教师国家级奖项情况
export const TjdBigTeacherAwardDetail = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-tjd-big-teacher-award-detail', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 首页 - 详情 - 国家级平台建设情况
export const TjdBigPlatformDetail = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-tjd-big-platform-detail', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 首页 - （四大）主持国家重点重大项目情况
export const TjdBigProject = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-tjd-hold-big-project', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 首页 - （四大）学科国家级教学成果奖情况
export const TjdBigAward = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-tjd-big-award', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 首页 - （四大）教师国家级奖项情况
export const TjdBigTeacherAward = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-tjd-big-teacher-award', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 首页 - （四大）国家级平台建设情况
export const TjdBigPlatform = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-tjd-big-platform', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 对比 - 学科对比
export const CompareSubject = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-compare-subject', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 整体 - 01
export const OverView01 = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-overview-listen-01', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 整体 - 02 - 国家级教学成果奖数量
export const OverView02Awards = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-overview-listen-02-awards', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 整体 - 02 - 人才培养基地
export const OverView02Platform = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-overview-listen-02-platform', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 整体 - 03 - 国家级团队数量
export const OverView03Leader = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-overview-listen-03-leader', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 整体 - 03 - 国家级学术领军人才数量
export const OverView03LeaderNum = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-overview-listen-03-leadernum', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 整体 - 03 - 外籍专任教师数量
export const OverView03Foreign = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-overview-listen-03-foreign', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 整体 - 03 - 担任国内外重要期刊负责人
export const OverView03Response = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-overview-listen-03-response', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 整体 - 03 - 担任国际比赛负责人
export const OverView03Contest = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-overview-listen-03-contest', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 整体 - 04 - 教师在国内外发表顶级期刊数量
export const OverView04Top = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-overview-listen-04-top', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 整体 - 04 - 国家级科研平台数量
export const OverView04Research = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-overview-listen-04-research', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 整体 - 04 - 学科主持国家重点重大项目数量
export const OverView04Hold = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-overview-listen-04-hold', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 整体 - 05 - 国家级产教融合平台数
export const OverView05Platform = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-overview-listen-05-platform', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 详情 - 01 - 学科评估情况
export const Detail01Evaluation = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-1-evaluation', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 01 - 学科影响力情况
export const Detail01Influence = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-1-influence', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 01 - 学科建设经费数
export const Detail01Found = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-1-found', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 01 - 学科进展写实
export const Detail01Upload = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-1-docx', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 02 - 学科教学成果奖
export const Detail02Award = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-2-award', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 02 - 课程建设情况
export const Detail02Build = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-2-build', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 02 - 人才培养基地
export const Detail02Platform = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-2-platform', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 02 - 硕博导师情况
export const Detail02Teacher = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-2-teacher', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 02 - 学生国内外竞赛获奖情况
export const Detail02Contest = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-2-contest', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 02 - 学生发表代表性论文情况
export const Detail02Paper = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-2-paper', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 02 - 学科毕业生结构
export const Detail02Graduate = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-2-graduate', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 02 - 本学科留学生结构
export const Detail02Exchange = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-2-exchange', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 02 - 三个数字
export const Detail02Number = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-2-number', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 02 - 思想政治教育特色与成效
export const Detail02Docx = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-2-docx', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 03 - 专任教师队伍
export const Detail03Teacher = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-3-teacher', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 03 - 师资队伍国际水平
export const Detail03Level = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-3-level', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 03 - 师风师德建设
export const Detail03Docx = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-3-docx', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 04 - 教师获国内外重要奖项情况
export const Detail04Award = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-4-award', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 04 - 教师在国内外重要期刊发表代表性论文情况
export const Detail04Paper = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-4-paper', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 04 - 科研创新平台建设情况
export const Detail04Platform = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-4-platform', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 04 - 学科主持科研项目情况
export const Detail04Hold = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-4-hold', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 04 - 参与国内外标准指定项目数
export const Detail04Project = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-4-project', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 04 - 参与国际论文合作数量
export const Detail04Copaper = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-4-copaper', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 04 - 2个数字
export const Detail04Number = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-4-number', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 05 - 成果转化
export const Detail05Earn = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-5-earn', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 05 - 智库建设
export const Detail05Intelligent = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-5-intelligent', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 详情 - 05 - 服务社会
export const Detail05Docx = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/gov-detail-5-docx', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}

// 填报周期管理 - 省厅开关
export const FillCircleApi = () => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/fill_switch/fill_status', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
  })
}

// 填报周期管理 - 从开启到关闭
export const CloseFillCircleApi = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/fill_switch/status_change_close', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}


// 填报周期管理 - 从关闭到开启
export const OpenFillCircleApi = (data: object) => {
  const userInfo = getUserInfo()
  return request(baseUrl+'/api/fill_switch/status_change_open', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'Authorization': userInfo.token
    },
    data: data
  })
}
